/**
 * 
 */
package com.huarui.task.action;

import java.util.List;

import org.apache.struts2.ServletActionContext;
import org.ewaf.framework.action.BaseAction;
import org.ewaf.framework.model.PagingInfo;

import com.huarui.task.model.TaskDetail;
import com.huarui.task.model.TaskListInfo;
import com.huarui.task.service.TaskDetailService;
import com.huarui.task.service.TaskService;
import com.huarui.user.security.UserHolder;
import com.opensymphony.xwork2.Action;

/**
 * @author sunpeng
 * 
 */
public class TaskAction extends BaseAction {

	private static final long serialVersionUID = -3073487707097666086L;
	private TaskService taskService;
	private TaskDetailService taskDetailService;
	private int start = 0;
	private int limit = 20;
	private int taskId;

	public String paging() {
		PagingInfo<TaskListInfo, TaskListInfo> paginInfo = new PagingInfo<TaskListInfo, TaskListInfo>();
		paginInfo.setStart(this.start);
		paginInfo.setLimit(this.limit);
		this.taskService.getPagingNewTask(paginInfo);
		ServletActionContext.getContext().put("jsonResult", paginInfo);
		return Action.SUCCESS;

	}
	
	public String detail() {
		List<TaskDetail> details = this.taskDetailService.getTaskDetails(this.taskId);
		ServletActionContext.getContext().put("jsonResult", details);
		return Action.SUCCESS;
	}
	
	

	public void setTaskService(TaskService taskService) {
		this.taskService = taskService;
	}

	public void setTaskDetailService(TaskDetailService taskDetailService) {
		this.taskDetailService = taskDetailService;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getLimit() {
		return limit;
	}

	public void setLimit(int limit) {
		this.limit = limit;
	}

	public int getTaskId() {
		return taskId;
	}

	public void setTaskId(int taskId) {
		this.taskId = taskId;
	}

}
